﻿using BoriPeter.FatSecret.Messages;
using BoriPeter.FitnessJournal8.Interfaces;
using BoriPeter.FitnessJournal8.Models;
using BoriPeter.FatSecret.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BoriPeter.FatSecret.Models;

namespace BoriPeter.FatSecret
{
    public class FatSecretDailyBurnedDataSource
    {
        public async Task<List<DailyEntry>> GetMonthListAsync(DateTime _dayOfMonth)
        {
            if (FatSecretCommon.AccessToken != null)
            {
                var dailyBurnedGetMonth = new ExcerciseEntriesGetMonth(_dayOfMonth);
                var dailyIntakeList = await dailyBurnedGetMonth.SendAsync();
                return dailyIntakeList.Convert();
            }
            else
                return new List<DailyEntry>();
        }

        public async Task<DailyEntry> GetDailyEntryAsync(DateTime _date)
        {
            if (FatSecretCommon.AccessToken != null)
            {
                var dailyBurnedGetDay = new ExerciseEntriesGet(_date);
                ExerciseEntriesGetModel dailyBurnedList = await dailyBurnedGetDay.SendAsync();
                return dailyBurnedList.Convert();
            }
            else
                return new DailyEntry();
        }
    }
}
